home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Source Code
/
C++
/
Applications
/
Mic-1 v1.0
/
Project and Source
/
Source
/
mic_global_functions.cpp
< prev
next >
Wrap
Text File
|
1996-04-09
|
1KB
|
88 lines
/*
"global_functions.cpp"
This is just a real simple file containing a Death proc.
*/
#include "mic_global_functions.h"
#include "keymap.h"
void Death (short resCode)
{
StopAlert(resCode, nil);
ExitToShell();
}
void Pause (void)
{
while (!Button());
while (Button());
}
void Beep (void)
{
SysBeep(5);
}
short Min (short x, short y)
{
return (x < y) ? x : y;
}
short Max (short x, short y)
{
return (x > y) ? x : y;
}
void Catenate (Str255 Str1, Str255 Str2)
{
short Length;
Length = Min(Str2[0], 255 - Str1[0]);
if (Length > 0)
{
BlockMove(Str2 + 1, Str1 + Str1[0] + 1, (long)Length);
Str1[0] += Length;
}
}
void CopyString (StringPtr sourceStr, StringPtr destStr)
{
short copyLen;
copyLen = sourceStr[0];
if (copyLen > 0)
{
BlockMove(sourceStr, destStr, (long) copyLen + 1L);
}
}
Boolean EqualStrings (Str255 Str1, Str255 Str2)
{
short i = 0;
Boolean equal = true;
if (Str1[0] != Str2[0])
return false;
else
{
while (equal)
{
if (Str1[i] != Str2[i])
equal = false;
else i++;
}
return true;
}
return equal;
}
Boolean CheckForEscapeKey (void)
{
KeyMap Keys;
GetKeys(Keys);
if (Keys[ESC_POS] & ESC_KEY)
return true;
else return false;
}